/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "tipodocumento")
@NamedQueries({
    @NamedQuery(name = "Tipodocumento.findAll", query = "SELECT t FROM Tipodocumento t"),
    @NamedQuery(name = "Tipodocumento.findByIdtipodocumento", query = "SELECT t FROM Tipodocumento t WHERE t.idtipodocumento = :idtipodocumento"),
    @NamedQuery(name = "Tipodocumento.findByNombretipo", query = "SELECT t FROM Tipodocumento t WHERE t.nombretipo = :nombretipo")})
public class Tipodocumento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idtipodocumento")
    private Integer idtipodocumento;
    @Basic(optional = false)
    @Column(name = "nombretipo")
    private String nombretipo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipodocumento")
    private Collection<Operario> operarioCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipodocumento")
    private Collection<Transportista> transportistaCollection;

    public Tipodocumento() {
    }

    public Tipodocumento(Integer idtipodocumento) {
        this.idtipodocumento = idtipodocumento;
    }

    public Tipodocumento(Integer idtipodocumento, String nombretipo) {
        this.idtipodocumento = idtipodocumento;
        this.nombretipo = nombretipo;
    }

    public Integer getIdtipodocumento() {
        return idtipodocumento;
    }

    public void setIdtipodocumento(Integer idtipodocumento) {
        this.idtipodocumento = idtipodocumento;
    }

    public String getNombretipo() {
        return nombretipo;
    }

    public void setNombretipo(String nombretipo) {
        this.nombretipo = nombretipo;
    }

    public Collection<Operario> getOperarioCollection() {
        return operarioCollection;
    }

    public void setOperarioCollection(Collection<Operario> operarioCollection) {
        this.operarioCollection = operarioCollection;
    }

    public Collection<Transportista> getTransportistaCollection() {
        return transportistaCollection;
    }

    public void setTransportistaCollection(Collection<Transportista> transportistaCollection) {
        this.transportistaCollection = transportistaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idtipodocumento != null ? idtipodocumento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipodocumento)) {
            return false;
        }
        Tipodocumento other = (Tipodocumento) object;
        if ((this.idtipodocumento == null && other.idtipodocumento != null) || (this.idtipodocumento != null && !this.idtipodocumento.equals(other.idtipodocumento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Tipodocumento[idtipodocumento=" + idtipodocumento + "]";
    }

}
